<?php
	/**
	 * The abstract TableUserAddressGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableUserAddress subclass which
	 * extends this TableUserAddressGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableUserAddress class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property string $Firstname the value for strFirstname 
	 * @property string $Lastname the value for strLastname 
	 * @property string $Companyname the value for strCompanyname 
	 * @property string $Country the value for strCountry 
	 * @property string $City the value for strCity 
	 * @property string $Phone the value for strPhone 
	 * @property string $Fax the value for strFax 
	 * @property string $Address1 the value for strAddress1 (Not Null)
	 * @property string $Address2 the value for strAddress2 
	 * @property string $PostalCode the value for strPostalCode 
	 * @property QDateTime $CreateDate the value for dttCreateDate 
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property string $State the value for strState (Not Null)
	 * @property string $FirstnameKana the value for strFirstnameKana (Not Null)
	 * @property string $LastnameKana the value for strLastnameKana (Not Null)
	 * @property QDateTime $UpdateDate the value for dttUpdateDate (Not Null)
	 * @property TableUserProject $User the value for the TableUserProject object referenced by intUserId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableUserAddressGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_user_address.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_address.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_address.firstname
		 * @var string strFirstname
		 */
		protected $strFirstname;
		const FirstnameMaxLength = 100;
		const FirstnameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.lastname
		 * @var string strLastname
		 */
		protected $strLastname;
		const LastnameMaxLength = 100;
		const LastnameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.companyname
		 * @var string strCompanyname
		 */
		protected $strCompanyname;
		const CompanynameMaxLength = 100;
		const CompanynameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.country
		 * @var string strCountry
		 */
		protected $strCountry;
		const CountryMaxLength = 50;
		const CountryDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.city
		 * @var string strCity
		 */
		protected $strCity;
		const CityMaxLength = 50;
		const CityDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.phone
		 * @var string strPhone
		 */
		protected $strPhone;
		const PhoneMaxLength = 50;
		const PhoneDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.fax
		 * @var string strFax
		 */
		protected $strFax;
		const FaxMaxLength = 50;
		const FaxDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.address1
		 * @var string strAddress1
		 */
		protected $strAddress1;
		const Address1MaxLength = 255;
		const Address1Default = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.address2
		 * @var string strAddress2
		 */
		protected $strAddress2;
		const Address2MaxLength = 255;
		const Address2Default = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.postal_code
		 * @var string strPostalCode
		 */
		protected $strPostalCode;
		const PostalCodeMaxLength = 255;
		const PostalCodeDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.create_date
		 * @var QDateTime dttCreateDate
		 */
		protected $dttCreateDate;
		const CreateDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_address.state
		 * @var string strState
		 */
		protected $strState;
		const StateMaxLength = 100;
		const StateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.firstname_kana
		 * @var string strFirstnameKana
		 */
		protected $strFirstnameKana;
		const FirstnameKanaMaxLength = 100;
		const FirstnameKanaDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.lastname_kana
		 * @var string strLastnameKana
		 */
		protected $strLastnameKana;
		const LastnameKanaMaxLength = 100;
		const LastnameKanaDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_address.update_date
		 * @var QDateTime dttUpdateDate
		 */
		protected $dttUpdateDate;
		const UpdateDateDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_user_address.user_id.
		 *
		 * NOTE: Always use the User property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUser
		 */
		protected $objUser;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableUserAddress from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableUserAddress::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserAddress()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableUserAddresses
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableUserAddress::QueryArray to perform the LoadAll query
			try {
				return TableUserAddress::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableUserAddresses
		 * @return int
		 */
		public static function CountAll() {
			// Call TableUserAddress::QueryCount to perform the CountAll query
			return TableUserAddress::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();

			// Create/Build out the QueryBuilder object with TableUserAddress-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_user_address');
			TableUserAddress::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_user_address');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableUserAddress object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserAddress the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserAddress::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableUserAddress object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserAddress::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableUserAddress::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableUserAddress objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserAddress[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserAddress::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableUserAddress::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableUserAddress objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserAddress::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();

			$strQuery = TableUserAddress::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableuseraddress', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableUserAddress::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableUserAddress
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_user_address';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'firstname', $strAliasPrefix . 'firstname');
			$objBuilder->AddSelectItem($strTableName, 'lastname', $strAliasPrefix . 'lastname');
			$objBuilder->AddSelectItem($strTableName, 'companyname', $strAliasPrefix . 'companyname');
			$objBuilder->AddSelectItem($strTableName, 'country', $strAliasPrefix . 'country');
			$objBuilder->AddSelectItem($strTableName, 'city', $strAliasPrefix . 'city');
			$objBuilder->AddSelectItem($strTableName, 'phone', $strAliasPrefix . 'phone');
			$objBuilder->AddSelectItem($strTableName, 'fax', $strAliasPrefix . 'fax');
			$objBuilder->AddSelectItem($strTableName, 'address1', $strAliasPrefix . 'address1');
			$objBuilder->AddSelectItem($strTableName, 'address2', $strAliasPrefix . 'address2');
			$objBuilder->AddSelectItem($strTableName, 'postal_code', $strAliasPrefix . 'postal_code');
			$objBuilder->AddSelectItem($strTableName, 'create_date', $strAliasPrefix . 'create_date');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
			$objBuilder->AddSelectItem($strTableName, 'state', $strAliasPrefix . 'state');
			$objBuilder->AddSelectItem($strTableName, 'firstname_kana', $strAliasPrefix . 'firstname_kana');
			$objBuilder->AddSelectItem($strTableName, 'lastname_kana', $strAliasPrefix . 'lastname_kana');
			$objBuilder->AddSelectItem($strTableName, 'update_date', $strAliasPrefix . 'update_date');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableUserAddress from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableUserAddress::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableUserAddress
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableUserAddress object
			$objToReturn = new TableUserAddress();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'firstname', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'firstname'] : $strAliasPrefix . 'firstname';
			$objToReturn->strFirstname = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'lastname', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'lastname'] : $strAliasPrefix . 'lastname';
			$objToReturn->strLastname = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'companyname', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'companyname'] : $strAliasPrefix . 'companyname';
			$objToReturn->strCompanyname = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'country', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'country'] : $strAliasPrefix . 'country';
			$objToReturn->strCountry = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'city', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'city'] : $strAliasPrefix . 'city';
			$objToReturn->strCity = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'phone', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'phone'] : $strAliasPrefix . 'phone';
			$objToReturn->strPhone = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'fax', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fax'] : $strAliasPrefix . 'fax';
			$objToReturn->strFax = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'address1', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address1'] : $strAliasPrefix . 'address1';
			$objToReturn->strAddress1 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'address2', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address2'] : $strAliasPrefix . 'address2';
			$objToReturn->strAddress2 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'postal_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'postal_code'] : $strAliasPrefix . 'postal_code';
			$objToReturn->strPostalCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'create_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'create_date'] : $strAliasPrefix . 'create_date';
			$objToReturn->dttCreateDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'state', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'state'] : $strAliasPrefix . 'state';
			$objToReturn->strState = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'firstname_kana', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'firstname_kana'] : $strAliasPrefix . 'firstname_kana';
			$objToReturn->strFirstnameKana = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'lastname_kana', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'lastname_kana'] : $strAliasPrefix . 'lastname_kana';
			$objToReturn->strLastnameKana = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'update_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'update_date'] : $strAliasPrefix . 'update_date';
			$objToReturn->dttUpdateDate = $objDbRow->GetColumn($strAliasName, 'DateTime');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_user_address__';

			// Check for User Early Binding
			$strAlias = $strAliasPrefix . 'user_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUser = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableUserAddresses from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableUserAddress[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserAddress::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableUserAddress::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableUserAddress object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableUserAddress::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserAddress()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByUserId($intUserId, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByUserId query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->UserId, $intUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @return int
		*/
		public static function CountByUserId($intUserId) {
			// Call TableUserAddress::QueryCount to perform the CountByUserId query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->UserId, $intUserId)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Firstname Index(es)
		 * @param string $strFirstname
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByFirstname($strFirstname, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByFirstname query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Firstname, $strFirstname),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Firstname Index(es)
		 * @param string $strFirstname
		 * @return int
		*/
		public static function CountByFirstname($strFirstname) {
			// Call TableUserAddress::QueryCount to perform the CountByFirstname query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Firstname, $strFirstname)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Lastname Index(es)
		 * @param string $strLastname
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByLastname($strLastname, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByLastname query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Lastname, $strLastname),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Lastname Index(es)
		 * @param string $strLastname
		 * @return int
		*/
		public static function CountByLastname($strLastname) {
			// Call TableUserAddress::QueryCount to perform the CountByLastname query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Lastname, $strLastname)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Companyname Index(es)
		 * @param string $strCompanyname
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByCompanyname($strCompanyname, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByCompanyname query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Companyname, $strCompanyname),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Companyname Index(es)
		 * @param string $strCompanyname
		 * @return int
		*/
		public static function CountByCompanyname($strCompanyname) {
			// Call TableUserAddress::QueryCount to perform the CountByCompanyname query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Companyname, $strCompanyname)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Country Index(es)
		 * @param string $strCountry
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByCountry($strCountry, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByCountry query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Country, $strCountry),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Country Index(es)
		 * @param string $strCountry
		 * @return int
		*/
		public static function CountByCountry($strCountry) {
			// Call TableUserAddress::QueryCount to perform the CountByCountry query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Country, $strCountry)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by City Index(es)
		 * @param string $strCity
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByCity($strCity, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByCity query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->City, $strCity),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by City Index(es)
		 * @param string $strCity
		 * @return int
		*/
		public static function CountByCity($strCity) {
			// Call TableUserAddress::QueryCount to perform the CountByCity query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->City, $strCity)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Phone Index(es)
		 * @param string $strPhone
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByPhone($strPhone, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByPhone query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Phone, $strPhone),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Phone Index(es)
		 * @param string $strPhone
		 * @return int
		*/
		public static function CountByPhone($strPhone) {
			// Call TableUserAddress::QueryCount to perform the CountByPhone query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Phone, $strPhone)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Fax Index(es)
		 * @param string $strFax
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByFax($strFax, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByFax query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Fax, $strFax),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Fax Index(es)
		 * @param string $strFax
		 * @return int
		*/
		public static function CountByFax($strFax) {
			// Call TableUserAddress::QueryCount to perform the CountByFax query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Fax, $strFax)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Address1 Index(es)
		 * @param string $strAddress1
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByAddress1($strAddress1, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByAddress1 query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Address1, $strAddress1),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Address1 Index(es)
		 * @param string $strAddress1
		 * @return int
		*/
		public static function CountByAddress1($strAddress1) {
			// Call TableUserAddress::QueryCount to perform the CountByAddress1 query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Address1, $strAddress1)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Address2 Index(es)
		 * @param string $strAddress2
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByAddress2($strAddress2, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByAddress2 query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Address2, $strAddress2),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Address2 Index(es)
		 * @param string $strAddress2
		 * @return int
		*/
		public static function CountByAddress2($strAddress2) {
			// Call TableUserAddress::QueryCount to perform the CountByAddress2 query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Address2, $strAddress2)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by PostalCode Index(es)
		 * @param string $strPostalCode
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByPostalCode($strPostalCode, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByPostalCode query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->PostalCode, $strPostalCode),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by PostalCode Index(es)
		 * @param string $strPostalCode
		 * @return int
		*/
		public static function CountByPostalCode($strPostalCode) {
			// Call TableUserAddress::QueryCount to perform the CountByPostalCode query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->PostalCode, $strPostalCode)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by CreateDate Index(es)
		 * @param QDateTime $dttCreateDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByCreateDate($dttCreateDate, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByCreateDate query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->CreateDate, $dttCreateDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by CreateDate Index(es)
		 * @param QDateTime $dttCreateDate
		 * @return int
		*/
		public static function CountByCreateDate($dttCreateDate) {
			// Call TableUserAddress::QueryCount to perform the CountByCreateDate query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->CreateDate, $dttCreateDate)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByStatus query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call TableUserAddress::QueryCount to perform the CountByStatus query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->Status, $intStatus)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by UserId, Status Index(es)
		 * @param integer $intUserId
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByUserIdStatus($intUserId, $intStatus, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByUserIdStatus query
			try {
				return TableUserAddress::QueryArray(
					QQ::AndCondition(
					QQ::Equal(QQN::TableUserAddress()->UserId, $intUserId),
					QQ::Equal(QQN::TableUserAddress()->Status, $intStatus)
					),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by UserId, Status Index(es)
		 * @param integer $intUserId
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByUserIdStatus($intUserId, $intStatus) {
			// Call TableUserAddress::QueryCount to perform the CountByUserIdStatus query
			return TableUserAddress::QueryCount(
				QQ::AndCondition(
				QQ::Equal(QQN::TableUserAddress()->UserId, $intUserId),
				QQ::Equal(QQN::TableUserAddress()->Status, $intStatus)
				)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by FirstnameKana Index(es)
		 * @param string $strFirstnameKana
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByFirstnameKana($strFirstnameKana, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByFirstnameKana query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->FirstnameKana, $strFirstnameKana),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by FirstnameKana Index(es)
		 * @param string $strFirstnameKana
		 * @return int
		*/
		public static function CountByFirstnameKana($strFirstnameKana) {
			// Call TableUserAddress::QueryCount to perform the CountByFirstnameKana query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->FirstnameKana, $strFirstnameKana)
			);
		}
			
		/**
		 * Load an array of TableUserAddress objects,
		 * by LastnameKana Index(es)
		 * @param string $strLastnameKana
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserAddress[]
		*/
		public static function LoadArrayByLastnameKana($strLastnameKana, $objOptionalClauses = null) {
			// Call TableUserAddress::QueryArray to perform the LoadArrayByLastnameKana query
			try {
				return TableUserAddress::QueryArray(
					QQ::Equal(QQN::TableUserAddress()->LastnameKana, $strLastnameKana),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserAddresses
		 * by LastnameKana Index(es)
		 * @param string $strLastnameKana
		 * @return int
		*/
		public static function CountByLastnameKana($strLastnameKana) {
			// Call TableUserAddress::QueryCount to perform the CountByLastnameKana query
			return TableUserAddress::QueryCount(
				QQ::Equal(QQN::TableUserAddress()->LastnameKana, $strLastnameKana)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableUserAddress
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_user_address` (
							`user_id`,
							`firstname`,
							`lastname`,
							`companyname`,
							`country`,
							`city`,
							`phone`,
							`fax`,
							`address1`,
							`address2`,
							`postal_code`,
							`create_date`,
							`status`,
							`state`,
							`firstname_kana`,
							`lastname_kana`,
							`update_date`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->strFirstname) . ',
							' . $objDatabase->SqlVariable($this->strLastname) . ',
							' . $objDatabase->SqlVariable($this->strCompanyname) . ',
							' . $objDatabase->SqlVariable($this->strCountry) . ',
							' . $objDatabase->SqlVariable($this->strCity) . ',
							' . $objDatabase->SqlVariable($this->strPhone) . ',
							' . $objDatabase->SqlVariable($this->strFax) . ',
							' . $objDatabase->SqlVariable($this->strAddress1) . ',
							' . $objDatabase->SqlVariable($this->strAddress2) . ',
							' . $objDatabase->SqlVariable($this->strPostalCode) . ',
							' . $objDatabase->SqlVariable($this->dttCreateDate) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . ',
							' . $objDatabase->SqlVariable($this->strState) . ',
							' . $objDatabase->SqlVariable($this->strFirstnameKana) . ',
							' . $objDatabase->SqlVariable($this->strLastnameKana) . ',
							' . $objDatabase->SqlVariable($this->dttUpdateDate) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_user_address', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_user_address`
						SET
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`firstname` = ' . $objDatabase->SqlVariable($this->strFirstname) . ',
							`lastname` = ' . $objDatabase->SqlVariable($this->strLastname) . ',
							`companyname` = ' . $objDatabase->SqlVariable($this->strCompanyname) . ',
							`country` = ' . $objDatabase->SqlVariable($this->strCountry) . ',
							`city` = ' . $objDatabase->SqlVariable($this->strCity) . ',
							`phone` = ' . $objDatabase->SqlVariable($this->strPhone) . ',
							`fax` = ' . $objDatabase->SqlVariable($this->strFax) . ',
							`address1` = ' . $objDatabase->SqlVariable($this->strAddress1) . ',
							`address2` = ' . $objDatabase->SqlVariable($this->strAddress2) . ',
							`postal_code` = ' . $objDatabase->SqlVariable($this->strPostalCode) . ',
							`create_date` = ' . $objDatabase->SqlVariable($this->dttCreateDate) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . ',
							`state` = ' . $objDatabase->SqlVariable($this->strState) . ',
							`firstname_kana` = ' . $objDatabase->SqlVariable($this->strFirstnameKana) . ',
							`lastname_kana` = ' . $objDatabase->SqlVariable($this->strLastnameKana) . ',
							`update_date` = ' . $objDatabase->SqlVariable($this->dttUpdateDate) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableUserAddress
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableUserAddress with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_address`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableUserAddresses
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_address`');
		}

		/**
		 * Truncate table_user_address table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableUserAddress::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_user_address`');
		}

		/**
		 * Reload this TableUserAddress from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableUserAddress object.');

			// Reload the Object
			$objReloaded = TableUserAddress::Load($this->intId);

			// Update $this's local variables to match
			$this->UserId = $objReloaded->UserId;
			$this->strFirstname = $objReloaded->strFirstname;
			$this->strLastname = $objReloaded->strLastname;
			$this->strCompanyname = $objReloaded->strCompanyname;
			$this->strCountry = $objReloaded->strCountry;
			$this->strCity = $objReloaded->strCity;
			$this->strPhone = $objReloaded->strPhone;
			$this->strFax = $objReloaded->strFax;
			$this->strAddress1 = $objReloaded->strAddress1;
			$this->strAddress2 = $objReloaded->strAddress2;
			$this->strPostalCode = $objReloaded->strPostalCode;
			$this->dttCreateDate = $objReloaded->dttCreateDate;
			$this->intStatus = $objReloaded->intStatus;
			$this->strState = $objReloaded->strState;
			$this->strFirstnameKana = $objReloaded->strFirstnameKana;
			$this->strLastnameKana = $objReloaded->strLastnameKana;
			$this->dttUpdateDate = $objReloaded->dttUpdateDate;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'Firstname':
					/**
					 * Gets the value for strFirstname 
					 * @return string
					 */
					return $this->strFirstname;

				case 'Lastname':
					/**
					 * Gets the value for strLastname 
					 * @return string
					 */
					return $this->strLastname;

				case 'Companyname':
					/**
					 * Gets the value for strCompanyname 
					 * @return string
					 */
					return $this->strCompanyname;

				case 'Country':
					/**
					 * Gets the value for strCountry 
					 * @return string
					 */
					return $this->strCountry;

				case 'City':
					/**
					 * Gets the value for strCity 
					 * @return string
					 */
					return $this->strCity;

				case 'Phone':
					/**
					 * Gets the value for strPhone 
					 * @return string
					 */
					return $this->strPhone;

				case 'Fax':
					/**
					 * Gets the value for strFax 
					 * @return string
					 */
					return $this->strFax;

				case 'Address1':
					/**
					 * Gets the value for strAddress1 (Not Null)
					 * @return string
					 */
					return $this->strAddress1;

				case 'Address2':
					/**
					 * Gets the value for strAddress2 
					 * @return string
					 */
					return $this->strAddress2;

				case 'PostalCode':
					/**
					 * Gets the value for strPostalCode 
					 * @return string
					 */
					return $this->strPostalCode;

				case 'CreateDate':
					/**
					 * Gets the value for dttCreateDate 
					 * @return QDateTime
					 */
					return $this->dttCreateDate;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;

				case 'State':
					/**
					 * Gets the value for strState (Not Null)
					 * @return string
					 */
					return $this->strState;

				case 'FirstnameKana':
					/**
					 * Gets the value for strFirstnameKana (Not Null)
					 * @return string
					 */
					return $this->strFirstnameKana;

				case 'LastnameKana':
					/**
					 * Gets the value for strLastnameKana (Not Null)
					 * @return string
					 */
					return $this->strLastnameKana;

				case 'UpdateDate':
					/**
					 * Gets the value for dttUpdateDate (Not Null)
					 * @return QDateTime
					 */
					return $this->dttUpdateDate;


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUser) && (!is_null($this->intUserId)))
							$this->objUser = TableUserProject::Load($this->intUserId);
						return $this->objUser;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUser = null;
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Firstname':
					/**
					 * Sets the value for strFirstname 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFirstname = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Lastname':
					/**
					 * Sets the value for strLastname 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strLastname = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Companyname':
					/**
					 * Sets the value for strCompanyname 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strCompanyname = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Country':
					/**
					 * Sets the value for strCountry 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strCountry = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'City':
					/**
					 * Sets the value for strCity 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strCity = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Phone':
					/**
					 * Sets the value for strPhone 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPhone = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Fax':
					/**
					 * Sets the value for strFax 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFax = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Address1':
					/**
					 * Sets the value for strAddress1 (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strAddress1 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Address2':
					/**
					 * Sets the value for strAddress2 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strAddress2 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PostalCode':
					/**
					 * Sets the value for strPostalCode 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPostalCode = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'CreateDate':
					/**
					 * Sets the value for dttCreateDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttCreateDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'State':
					/**
					 * Sets the value for strState (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strState = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FirstnameKana':
					/**
					 * Sets the value for strFirstnameKana (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFirstnameKana = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'LastnameKana':
					/**
					 * Sets the value for strLastnameKana (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strLastnameKana = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UpdateDate':
					/**
					 * Sets the value for dttUpdateDate (Not Null)
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttUpdateDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserId = null;
						$this->objUser = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved User for this TableUserAddress');

						// Update Local Member Variables
						$this->objUser = $mixValue;
						$this->intUserId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableUserAddress"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="User" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="Firstname" type="xsd:string"/>';
			$strToReturn .= '<element name="Lastname" type="xsd:string"/>';
			$strToReturn .= '<element name="Companyname" type="xsd:string"/>';
			$strToReturn .= '<element name="Country" type="xsd:string"/>';
			$strToReturn .= '<element name="City" type="xsd:string"/>';
			$strToReturn .= '<element name="Phone" type="xsd:string"/>';
			$strToReturn .= '<element name="Fax" type="xsd:string"/>';
			$strToReturn .= '<element name="Address1" type="xsd:string"/>';
			$strToReturn .= '<element name="Address2" type="xsd:string"/>';
			$strToReturn .= '<element name="PostalCode" type="xsd:string"/>';
			$strToReturn .= '<element name="CreateDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="State" type="xsd:string"/>';
			$strToReturn .= '<element name="FirstnameKana" type="xsd:string"/>';
			$strToReturn .= '<element name="LastnameKana" type="xsd:string"/>';
			$strToReturn .= '<element name="UpdateDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableUserAddress', $strComplexTypeArray)) {
				$strComplexTypeArray['TableUserAddress'] = TableUserAddress::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableUserAddress::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableUserAddress();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'User')) &&
				($objSoapObject->User))
				$objToReturn->User = TableUserProject::GetObjectFromSoapObject($objSoapObject->User);
			if (property_exists($objSoapObject, 'Firstname'))
				$objToReturn->strFirstname = $objSoapObject->Firstname;
			if (property_exists($objSoapObject, 'Lastname'))
				$objToReturn->strLastname = $objSoapObject->Lastname;
			if (property_exists($objSoapObject, 'Companyname'))
				$objToReturn->strCompanyname = $objSoapObject->Companyname;
			if (property_exists($objSoapObject, 'Country'))
				$objToReturn->strCountry = $objSoapObject->Country;
			if (property_exists($objSoapObject, 'City'))
				$objToReturn->strCity = $objSoapObject->City;
			if (property_exists($objSoapObject, 'Phone'))
				$objToReturn->strPhone = $objSoapObject->Phone;
			if (property_exists($objSoapObject, 'Fax'))
				$objToReturn->strFax = $objSoapObject->Fax;
			if (property_exists($objSoapObject, 'Address1'))
				$objToReturn->strAddress1 = $objSoapObject->Address1;
			if (property_exists($objSoapObject, 'Address2'))
				$objToReturn->strAddress2 = $objSoapObject->Address2;
			if (property_exists($objSoapObject, 'PostalCode'))
				$objToReturn->strPostalCode = $objSoapObject->PostalCode;
			if (property_exists($objSoapObject, 'CreateDate'))
				$objToReturn->dttCreateDate = new QDateTime($objSoapObject->CreateDate);
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, 'State'))
				$objToReturn->strState = $objSoapObject->State;
			if (property_exists($objSoapObject, 'FirstnameKana'))
				$objToReturn->strFirstnameKana = $objSoapObject->FirstnameKana;
			if (property_exists($objSoapObject, 'LastnameKana'))
				$objToReturn->strLastnameKana = $objSoapObject->LastnameKana;
			if (property_exists($objSoapObject, 'UpdateDate'))
				$objToReturn->dttUpdateDate = new QDateTime($objSoapObject->UpdateDate);
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableUserAddress::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objUser)
				$objObject->objUser = TableUserProject::GetSoapObjectFromObject($objObject->objUser, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserId = null;
			if ($objObject->dttCreateDate)
				$objObject->dttCreateDate = $objObject->dttCreateDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttUpdateDate)
				$objObject->dttUpdateDate = $objObject->dttUpdateDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableUserAddress extends QQNode {
		protected $strTableName = 'table_user_address';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserAddress';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'Firstname':
					return new QQNode('firstname', 'Firstname', 'string', $this);
				case 'Lastname':
					return new QQNode('lastname', 'Lastname', 'string', $this);
				case 'Companyname':
					return new QQNode('companyname', 'Companyname', 'string', $this);
				case 'Country':
					return new QQNode('country', 'Country', 'string', $this);
				case 'City':
					return new QQNode('city', 'City', 'string', $this);
				case 'Phone':
					return new QQNode('phone', 'Phone', 'string', $this);
				case 'Fax':
					return new QQNode('fax', 'Fax', 'string', $this);
				case 'Address1':
					return new QQNode('address1', 'Address1', 'string', $this);
				case 'Address2':
					return new QQNode('address2', 'Address2', 'string', $this);
				case 'PostalCode':
					return new QQNode('postal_code', 'PostalCode', 'string', $this);
				case 'CreateDate':
					return new QQNode('create_date', 'CreateDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'State':
					return new QQNode('state', 'State', 'string', $this);
				case 'FirstnameKana':
					return new QQNode('firstname_kana', 'FirstnameKana', 'string', $this);
				case 'LastnameKana':
					return new QQNode('lastname_kana', 'LastnameKana', 'string', $this);
				case 'UpdateDate':
					return new QQNode('update_date', 'UpdateDate', 'QDateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableUserAddress extends QQReverseReferenceNode {
		protected $strTableName = 'table_user_address';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserAddress';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'Firstname':
					return new QQNode('firstname', 'Firstname', 'string', $this);
				case 'Lastname':
					return new QQNode('lastname', 'Lastname', 'string', $this);
				case 'Companyname':
					return new QQNode('companyname', 'Companyname', 'string', $this);
				case 'Country':
					return new QQNode('country', 'Country', 'string', $this);
				case 'City':
					return new QQNode('city', 'City', 'string', $this);
				case 'Phone':
					return new QQNode('phone', 'Phone', 'string', $this);
				case 'Fax':
					return new QQNode('fax', 'Fax', 'string', $this);
				case 'Address1':
					return new QQNode('address1', 'Address1', 'string', $this);
				case 'Address2':
					return new QQNode('address2', 'Address2', 'string', $this);
				case 'PostalCode':
					return new QQNode('postal_code', 'PostalCode', 'string', $this);
				case 'CreateDate':
					return new QQNode('create_date', 'CreateDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'State':
					return new QQNode('state', 'State', 'string', $this);
				case 'FirstnameKana':
					return new QQNode('firstname_kana', 'FirstnameKana', 'string', $this);
				case 'LastnameKana':
					return new QQNode('lastname_kana', 'LastnameKana', 'string', $this);
				case 'UpdateDate':
					return new QQNode('update_date', 'UpdateDate', 'QDateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>